/**
 * @description 表格
 */
import { Button, Space } from "antd"
import React from "react";
import AbIcon from "@/components/DecorateIcons/Ab_Icon";

function ListHeader({ base }) {
  let {
    headerIconFlag,
    header_icon_add,
    header_icon_deletes,
    header_icon_others,
    header_text_add,
    header_text_deletes,
  } = base

  const headerButtons = [
    {
      title: header_text_add,
      name: '新增',
      key: 'add',
      className: 'action-add',
      icon: headerIconFlag ? header_icon_add : null,
    },
    {
      title: header_text_deletes,
      name: '删除',
      key: 'deletes',
      className: 'action-deletes',
      icon: headerIconFlag ? header_icon_deletes : null,
    },
    {
      title: '其它',
      name: '其它',
      key: 'other',
      icon: headerIconFlag ? header_icon_others : null,
    },
  ]
  return (
    <Space size="small" className="list-btn-box">
      {headerButtons.map(item => (
        <Button
          key={item.key}
          className={item.className || 'action-others'}
          icon={item.icon ? <AbIcon iconName={item.icon} /> : null}
        >{item.title}</Button>
      )
      )}
    </Space>
  )
}

export default React.memo(ListHeader)